<%--                                                                       --%>
<%-- Copyright (c) 2003-2005 BroadVision, Inc.  All rights reserved.       --%>
<%--                                                                       --%>
<%-- This software is copyrighted. Under the copyright laws, this software --%>
<%-- may not be copied, in whole or in part, without prior written consent --%>
<%-- of BroadVision, Inc. or its assignees. This software is provided      --%>
<%-- under the terms of a license between BroadVision and the recipient,   --%>
<%-- and its use is subject to the terms of that license.                  --%>
<%--                                                                       --%>
<%-- This software may be protected by one or more U.S. and International  --%>
<%-- patents.  Certain applications of BroadVision One-To-One software are --%>
<%-- covered by U.S. patent 5,710,887.                                     --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and BroadVision One-To-One are registered     --%>
<%-- trademarks of BroadVision, Inc., in the United States and the         --%>
<%-- European Community, and are trademarks of BroadVision, Inc., in other --%>
<%-- countries.  The BroadVision logo, is a trademark of BroadVision,      --%>
<%-- Inc., in the United States and other countries. Additionally, IONA    --%>
<%-- and Orbix are trademarks of IONA Technologies, Ltd.  RSA, MD5, and    --%>
<%-- RC2 are trademarks of RSA Data Security, Inc.                         --%>
<%--                                                                       --%>

<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %>
<%@ taglib uri="/WEB-INF/struts-bean-el.tld" prefix="bean-el" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/bv-html.tld" prefix="bvhtml" %>

<%
  String ctxPath = request.getContextPath();
%>

<script language="JavaScript" src="<%=request.getContextPath()%>/mt/js/date.js"></script>
<script language="JavaScript" src="<%=request.getContextPath()%>/bp/js/user_popup_funcs.js"></script>

<script language="JavaScript">

  //
  // Validate the user's input.
  //
  function validateForm() {
    var dateFrom = getDateOnly("processSearchForm", "lastModifiedDateFrom")
    var dateTo = getDateOnly("processSearchForm", "lastModifiedDateTo")
    if (document.processSearchForm.includeLastModifiedDateFrom.checked) {
      if (dateFrom == null) {
        alert('<bean-el:message key="bp.error.process.search.lastModifiedDateFrom" bundle="bp.messages"/>');
        return false;
      }
    }
    if (document.processSearchForm.includeLastModifiedDateTo.checked) {
      if (dateTo == null) {
        alert('<bean-el:message key="bp.error.process.search.lastModifiedDateTo" bundle="bp.messages"/>');
        return false;
      }
    }
    if (document.processSearchForm.includeLastModifiedDateFrom.checked && 
      document.processSearchForm.includeLastModifiedDateTo.checked &&
      dateFrom > dateTo ) {
      alert('<bean-el:message key="bp.process.processSearch.error.lastModifiedDateStartLaterThanEnd" bundle="bp.messages"/>');
      return false;
    }
    if (doValidateEntriesPerPage("processSearchForm") == false) {
      return false;
    }
    document.processSearchForm.currentPageNumber.value = 0;
    return true;
  }

  function doBrowseAction(oid) {
    document.processSearchForm.currentCategoryOid.value = oid;
    document.processSearchForm.action = '<c:url value="/bp/processBrowse.do"/>';
    document.processSearchForm.submit();
  }

  function doProcessEditAction(oid) {
    document.processSearchForm.processOid.value = oid;
    document.processSearchForm.action = '<c:url value="/bp/processEdit.do"/>';
    document.processSearchForm.submit();
  }

  function doProcessInstancesAction(oid) {
    document.processSearchForm.processOid.value = oid;
    document.processSearchForm.action = '<c:url value="/bp/processInstances.do"/>';
    document.processSearchForm.submit();
  }

  function doProcessOnOffOneAction(oid, online) {
    document.processSearchForm.oneOnly.value = true;
    document.processSearchForm.processOid.value = oid;
    document.processSearchForm.action = '<c:url value="/bp/processOnOff.do"/>';
    document.processSearchForm.setOnlineStatus.value = online;
    document.processSearchForm.forwardAction.value = '/bp/processSearch.do';
    document.processSearchForm.submit();
  }

  function doProcessOnOffAction(myform, online) {
    myform.oneOnly.value = false;
    myform.action = '<c:url value="/bp/processOnOff.do"/>';
    myform.setOnlineStatus.value = online;
    myform.forwardAction.value = '/bp/processSearch.do';
    myform.submit();
  }

  function check(field, button) {
    var SelectAllTxt = '<bean-el:message key="button.selectAll" bundle="bp.messages"/>';
    var UnselectAllTxt = '<bean-el:message key="button.unselectAll" bundle="bp.messages"/>';
    if (field == null) {
      button.value = SelectAllTxt;
    }
    var checkflag = "false";
    if (button.value == SelectAllTxt) {
      checkflag = "false";
    }
    if (button.value == UnselectAllTxt) {
      checkflag = "true";
    }
    var max = field.length;
    if (max > 1) {
      if (checkflag == "false") {
        for (i = 0; i < max; i++) {
          field[i].checked = true;
        }
        button.value = UnselectAllTxt;
      } else {
        for (i = 0; i < max; i++) {
          field[i].checked = false;
        }
        button.value = SelectAllTxt;
      }
    } else {
      if (checkflag == "false") {
        field.checked = true;
        button.value = UnselectAllTxt;
      } else {
        field.checked = false;
        button.value = SelectAllTxt;
      }
    }
  }
  
  function update(field, button) {
    var SelectAllTxt = '<bean-el:message key="button.selectAll" bundle="bp.messages"/>';
    var UnselectAllTxt = '<bean-el:message key="button.unselectAll" bundle="bp.messages"/>';
    if (field == null) {
      button.value = SelectAllTxt;
    }
    var checkflag = "false";
    if (button.value == SelectAllTxt) {
      checkflag = "false";
    }
    if (button.value == UnselectAllTxt) {
      checkflag = "true";
    }
    var max = field.length;
    if (max > 1) {
      if (checkflag == "false") {
        for (i = 0; i < max; i++) {
          if (field[i].checked == false) {
            return;
          }
        }
        button.value = UnselectAllTxt;
      } else {
        for (i = 0; i < max; i++) {
          if (field[i].checked == true) {
            return;
          }
        }
        button.value = SelectAllTxt;
      }
    } else {
      if (checkflag == "false") {
        if (field.checked == true) {
          button.value = UnselectAllTxt;
        }
      } else {
        if (field.checked == false) {
          button.value = SelectAllTxt;
        }
      }
    }
  }

  function isAnyChecked(field, alertmsg, confirmmsg) {
    if (field == null) {
      if (alertmsg != null && alertmsg.length > 0) {
        alert(alertmsg);
      }
      return false;
    }
    else if (field.length == null) {
      if (field.checked == false) {
        if (alertmsg != null && alertmsg.length > 0) {
          alert(alertmsg);
        }
        return false;
      }
      else {
        if (confirmmsg != null && confirmmsg.length > 0) {
          return confirm(confirmmsg);
        }
        else {
          return true;
        }
      }
    }
    else {
      for (var j = 0; j < field.length; j++) {
        if (field[j].checked) {
          if (confirmmsg != null && confirmmsg.length > 0) {
            return confirm(confirmmsg);
          }
          else {
            return true;
          }
        }
      }
      if (alertmsg != null && alertmsg.length > 0) {
        alert(alertmsg);
      }
      return false;
    }
  }
  
  function updateRadio(thebox, theradio) {
    if (thebox.checked == true) {
      theradio[1].checked = true;
    }
  }

  function updateCheckbox(theradio, thebox) {
    if (theradio[0].checked == true) {
      thebox.checked = false;
    }
  }

  function setUserAlias(formName, fieldName, fieldValue) {
    // this page does not have any hidden fields that rely on the popup,
    // we do not need a refresh url.
    var refreshUrl = null;
    setFieldValue(refreshUrl, formName, fieldName, fieldValue);
  }

  function gotoFirstPage(formName) {
    if (doValidateEntriesPerPage(formName) == false) {
      return false;
    }
    var thisForm = document.forms[formName];
    if (thisForm != null) {
      thisForm.currentPageNumber.value = 1;
      thisForm.submit();
    }
  }
  
  function gotoPreviousPage(formName) {
    if (doValidateEntriesPerPage(formName) == false) {
      return false;
    }
    var thisForm = document.forms[formName];
    if (thisForm != null) {
      var currentPageNumber = thisForm.currentPageNumber.value;
      currentPageNumber--;
      if (thisForm.entriesPerPage.value != <c:out value="${processSearchForm.map.entriesPerPage}"/>) {
        currentPageNumber = 1;
      }
      if (currentPageNumber > 0) {
        thisForm.currentPageNumber.value = currentPageNumber;
        thisForm.submit();
      }
    }
  }
  
  function gotoNextPage(formName) {
    if (doValidateEntriesPerPage(formName) == false) {
      return false;
    }
    var thisForm = document.forms[formName];
    if (thisForm != null) {
      var currentPageNumber = thisForm.currentPageNumber.value;
      currentPageNumber++;
      if (thisForm.entriesPerPage.value != <c:out value="${processSearchForm.map.entriesPerPage}"/>) {
        currentPageNumber = 1;
      }
      if (currentPageNumber <= thisForm.totalPageNumber.value) {
        thisForm.currentPageNumber.value = currentPageNumber;
        thisForm.submit();
      }
    }
  }
  
  function gotoLastPage(formName) {
    if (doValidateEntriesPerPage(formName) == false) {
      return false;
    }
    var thisForm = document.forms[formName];
    if (thisForm != null) {
      if (thisForm.entriesPerPage.value != <c:out value="${processSearchForm.map.entriesPerPage}"/>) {
        thisForm.currentPageNumber.value = 1;
      }
      else {
        thisForm.currentPageNumber.value = thisForm.totalPageNumber.value;
      }
      thisForm.submit();
    }
  }

  function doGo(formName) {
    if (doValidateEntriesPerPage(formName) == false) {
      return false;
    }
    var thisForm = document.forms[formName];
    if (thisForm != null) {
      if (thisForm.entriesPerPage.value != <c:out value="${processSearchForm.map.entriesPerPage}"/>) {
        thisForm.currentPageNumber.value = 1;
        thisForm.submit();
        return true;
      }
    }
    return false;
  }
  
  function checkNumberOnly(e) {
    var charCode = (navigator.appName == "Netscape") ? e.which : e.keyCode;
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
      return false;
    }
    else {
      return true;
    }
  }

  function doValidateEntriesPerPage(formName) {
    var thisForm = document.forms[formName];
    if (thisForm != null) {
      if (thisForm.entriesPerPage == null) {
        return true;
      }
      var entriesPerPageString = thisForm.entriesPerPage.value;
      var len = entriesPerPageString.length;
      var i = 0;
      for (i = 0; i < len; i++) {
        if (entriesPerPageString.charAt(i) < '0' || entriesPerPageString.charAt(i) > '9') {
          alert("<bean-el:message key="bp.common.pagination.validation.itemsPerPage" bundle="bp.messages"/>");
          thisForm.entriesPerPage.select();
          thisForm.entriesPerPage.focus();
          return false;
        }
      }
      if (thisForm.entriesPerPage.value < 1 || thisForm.entriesPerPage.value > 2147483647) {
        alert("<bean-el:message key="bp.common.pagination.validation.itemsPerPage" bundle="bp.messages"/>");
        thisForm.entriesPerPage.select();
        thisForm.entriesPerPage.focus();
        return false;
      }
      else {
        return true;
      }
    }
    return false;
  }

</script>

<% 
  java.util.HashMap map = new java.util.HashMap();
  String catOid = request.getParameter("currentCategoryOid"); 
  if (catOid != null && catOid.length() > 0) {
    map.put("currentCategoryOid", catOid);
  }
  else {
    map.put("currentCategoryOid", "0");
  }
  pageContext.setAttribute("pagetabParam", map, PageContext.PAGE_SCOPE);
%>

<c:set var="editImg">
<img src="<%= ctxPath %>/mc/images/action/icon_edit.gif" width="15" height="15" border="0" class="actionIcon" alt="<bean-el:message key="image.alt.edit" bundle="mc.messages"/>" title="<bean-el:message key="image.alt.edit" bundle="mc.messages"/>">
</c:set>
<c:set var="offlineImg">
<img src="<%= ctxPath %>/mc/images/action/icon_offline.gif" width="15" height="15" border="0" class="actionIcon" alt="<bean-el:message key="image.alt.setOffline" bundle="mc.messages"/>" title="<bean-el:message key="image.alt.setOffline" bundle="mc.messages"/>">
</c:set>
<c:set var="onlineImg">
<img src="<%= ctxPath %>/mc/images/action/icon_online.gif" width="15" height="15" border="0" class="actionIcon" alt="<bean-el:message key="image.alt.setOnline" bundle="mc.messages"/>" title="<bean-el:message key="image.alt.setOnline" bundle="mc.messages"/>">
</c:set>
<c:set var="viewImg">
<img src="<%= ctxPath %>/mc/images/action/icon_view.gif" width="15" height="15" border="0" class="actionIcon" alt="<bean-el:message key="image.alt.viewInstances" bundle="bp.messages"/>" title="<bean-el:message key="image.alt.viewInstances" bundle="bp.messages"/>">
</c:set>

<html-el:form action="/bp/processSearch.do" focus="modelName" onsubmit="return validateForm();">
<html-el:hidden name="processSearchForm" property="currentCategoryOid"/>
<input type="hidden" name="processOid"/>
<input type="hidden" name="oneOnly"/>
<input type="hidden" name="setOnlineStatus"/>
<input type="hidden" name="forwardAction"/>
<html-el:hidden name="processSearchForm" property="currentPageNumber"/>
<html-el:hidden name="processSearchForm" property="totalPageNumber"/>
<html-el:hidden name="processSearchForm" property="lastPage"/>
<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="content area">
  <tr>
    <td valign="top" width="100%">
      <div class="pageTitle"><bean-el:message key="bp.process.processSearch.title" bundle="bp.messages"/></div> 
      <div class="errorMessage"><html-el:errors bundle="bp.messages"/></div>
      <div><%@include file="/mc/common/pagetab.jsp" %></div>
      <div class="breadcrumb">
        <logic:empty name="processSearchView" property="paths">
          <c:set var="currentCategoryName"><bean-el:message key="bp.process.processBrowse.rootCategory" bundle="bp.messages"/></c:set>
        </logic:empty>
        <logic:notEmpty name="processSearchView" property="paths">
          <html-el:link page="/bp/processBrowse.do">
            <bean-el:message key="bp.process.processBrowse.rootCategory" bundle="bp.messages"/>
          </html-el:link>
          <logic:iterate id="path" name="processSearchView" property="paths" indexId="i">
            <c:set var="currentCategoryName"><c:out value="${path.map.name}"/></c:set>
            &nbsp;<bean-el:message key="bp.process.pathSeparator" bundle="bp.messages"/>&nbsp;
            <logic:equal name="path" property="isCurrentPath" value="false">
              <a href='#' onclick="doBrowseAction('<c:out value="${path.map.oid}"/>');"><c:out value="${path.map.name}"/></a>
            </logic:equal>
            <logic:equal name="path" property="isCurrentPath" value="true">
              <c:out value="${path.map.name}"/>
            </logic:equal>
          </logic:iterate>
        </logic:notEmpty>
      </div>
      <div class="pageSubtitle">
        <span class="left"><bean-el:message key="bp.process.processSearch.searchCriteria" bundle="bp.messages"/></span>
        <span class="right">&nbsp;</span>
      </div> 
      <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="Search criterias">
        <tr> 
          <td class="label" width="30%">
            <bean-el:message key="bp.process.processSearch.lookIn" bundle="bp.messages"/>
          </td>
          <td class="labelField" width="70%" colspan="2">
            <logic:notEmpty name="processSearchView" property="paths">
              <html-el:radio name="processSearchForm" property="inCurrentCategory" value="0"
                onclick="updateCheckbox(this.form.inCurrentCategory, this.form.includeSubcategories);"/>
            </logic:notEmpty>
            <logic:empty name="processSearchView" property="paths">
              <html-el:radio name="processSearchForm" property="inCurrentCategory" value="0"/>
            </logic:empty>
            <bean-el:message key="bp.process.processSearch.allCategories" bundle="bp.messages"/>
            <logic:notEmpty name="processSearchView" property="paths">
              <br>
              <html-el:radio name="processSearchForm" property="inCurrentCategory" value="1"/>
              <c:out value="${currentCategoryName}"/>
              <br>            
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
              <html-el:checkbox name="processSearchForm" property="includeSubcategories"
                onclick="updateRadio(this, this.form.inCurrentCategory);"/>
              &nbsp;<bean-el:message key="bp.process.processSearch.includeSubcategories" bundle="bp.messages"/>
            </logic:notEmpty>
          </td>
        </tr>
        <tr> 
          <td class="label" width="30%">
            <bean-el:message key="bp.process.processName" bundle="bp.messages"/>
          </td>
          <td class="labelField" width="70%" colspan="2">
            <html-el:text name="processSearchForm" property="modelName" size="31" maxlength="80"/>
          </td>
        </tr>
        <tr> 
          <td class="label" width="30%">
            <bean-el:message key="bp.process.packageName" bundle="bp.messages"/>
          </td>
          <td class="labelField" width="70%" colspan="2">
            <html-el:text name="processSearchForm" property="packageName" size="31" maxlength="80"/>
          </td>
        </tr>
        <tr> 
          <td class="label" width="30%"><bean-el:message key="bp.process.processSearch.lastModifiedDate" bundle="bp.messages"/></td>
          <td class="labelField" width="10%" nowrap>
            <html-el:checkbox name="processSearchForm" property="includeLastModifiedDateFrom"/>
            <bean-el:message key="bp.process.processSearch.lastModifiedDate.from" bundle="bp.messages"/>
          </td>
          <td class="labelField" width="60%" nowrap>
            <bvhtml:date name="processSearchForm" property="lastModifiedDateFrom"
               onChangeMonth="onChangeMonth" onChangeYear="onChangeYear"/>
            <a href="JavaScript:datePopup('<html-el:rewrite page="/mt/calendar.do"/>', 'processSearchForm', 'lastModifiedDateFrom')">
              <img src="<%= ctxPath %>/mc/images/action/calendar.gif" width="23" height="22" border="0" align="absmiddle" alt="<bean-el:message key="image.alt.chooseDate" bundle="bp.messages"/>"></a>
            <html-el:hidden name="processSearchForm" property="lastModifiedDateFrom.hour" value="0"/>
            <html-el:hidden name="processSearchForm" property="lastModifiedDateFrom.minute" value="0"/>
            <html-el:hidden name="processSearchForm" property="lastModifiedDateFrom.ind" value="0"/>
          </td>
        </tr>
        <tr>
          <td class="label" width="30%">&nbsp;</td>
          <td class="labelField" width="10%" nowrap>
            <html-el:checkbox name="processSearchForm" property="includeLastModifiedDateTo"/>
            <bean-el:message key="bp.process.processSearch.lastModifiedDate.to" bundle="bp.messages"/>
          </td>
          <td class="labelField" width="60%" nowrap>
            <bvhtml:date name="processSearchForm" property="lastModifiedDateTo"
               onChangeMonth="onChangeMonth" onChangeYear="onChangeYear"/>
            <a href="JavaScript:datePopup('<html-el:rewrite page="/mt/calendar.do"/>', 'processSearchForm', 'lastModifiedDateTo')">
              <img src="<%= ctxPath %>/mc/images/action/calendar.gif" width="23" height="22" border="0" align="absmiddle" alt="<bean-el:message key="image.alt.chooseDate" bundle="bp.messages"/>"></a>
            <html-el:hidden name="processSearchForm" property="lastModifiedDateTo.hour" value="0"/>
            <html-el:hidden name="processSearchForm" property="lastModifiedDateTo.minute" value="0"/>
            <html-el:hidden name="processSearchForm" property="lastModifiedDateTo.ind" value="0"/>
          </td>
        </tr>
        <tr> 
          <td class="label" width="30%"><bean-el:message key="bp.process.processManagerID" bundle="bp.messages"/></td>
          <td class="labelField" width="70%" colspan="2">
            <html-el:text name="processSearchForm" property="manager" size="31" maxlength="80"/>
            <input type="button" name="browseUsers" class="pageButton"
              onClick="JavaScript:findUserPopup('<html-el:rewrite page="/mt/userSearchPopup.do"/>', 'processSearchForm', 'manager')"
              value='<bean-el:message key="button.browse" bundle="bp.messages"/>'>
          </td>
        </tr>
        <tr> 
          <td class="label" width="30%"><bean-el:message key="bp.process.processStatus" bundle="bp.messages"/></td>
          <td class="labelField" width="70%" colspan="2">
            <html-el:checkbox name="processSearchForm" property="statusOnline"/>
            <bean-el:message key="bp.process.status.online" bundle="bp.messages"/>&nbsp;
            <html-el:checkbox name="processSearchForm" property="statusOffline"/>
            <bean-el:message key="bp.process.status.offline" bundle="bp.messages"/>
          </td>
        </tr>
        <tr> 
          <td class="label" width="30%"><bean-el:message key="bp.process.processSearch.sortBy" bundle="bp.messages"/></td>
          <td class="labelField" width="70%" colspan="2">
            <html-el:select name="processSearchForm" property="sortBy" size="1">
              <html-el:option value="-1"><bean-el:message key="bp.process.processSearch.selectOption" bundle="bp.messages"/></html-el:option>
              <html-el:option value="0"><bean-el:message key="bp.process.processSearch.sortBy.processModel" bundle="bp.messages"/></html-el:option>
              <html-el:option value="1"><bean-el:message key="bp.process.processSearch.sortBy.lastModifiedDate" bundle="bp.messages"/></html-el:option>
              <html-el:option value="2"><bean-el:message key="bp.process.processSearch.sortBy.processModelManagerID" bundle="bp.messages"/></html-el:option>
            </html-el:select>
          </td>
        </tr>
      </table>
      <div class="pageButtonWrap" align="right">
        <html-el:submit property="showResults" styleClass="pageButton">
          <bean-el:message key="button.showResults" bundle="bp.messages"/>
        </html-el:submit>
      </div>
      <br>
      <logic:notEqual name="processSearchView" property="processCount" value="-1">
        <div class="pageSubtitle">
          <span class="left">
            <bean-el:message key="bp.process.processSearch.searchResultFound" arg0="${processSearchView.map.processCount}" bundle="bp.messages"/>
          </span>
          <span class="right">&nbsp;</span>
        </div>
        <logic:notEqual name="processSearchView" property="processCount" value="0">
        <div class="pageInstructions">
          <bean-el:message key="bp.process.processSearch.invalidManagerInstruction" bundle="bp.messages"/>
        </div>
        <div class="globalButtonWrap">
          <input type="button" name="selectAllProcesses" class="globalButton" 
            onClick="check(this.form.processOids, this);" 
            value='<bean-el:message key="button.selectAll" bundle="bp.messages"/>'>
          <input type="button" name="setOnline" class="globalButton" 
            onClick="if (isAnyChecked(this.form.processOids, '<bean-el:message key="bp.process.alert.atLeastOne" bundle="bp.messages"/>', '')) doProcessOnOffAction(this.form, true);" 
            value='<bean-el:message key="button.setOnline" bundle="bp.messages"/>'>
          <input type="button" name="setOffline" class="globalButton" 
            onClick="if (isAnyChecked(this.form.processOids, '<bean-el:message key="bp.process.alert.atLeastOne" bundle="bp.messages"/>', '')) doProcessOnOffAction(this.form, false);" 
            value='<bean-el:message key="button.setOffline" bundle="bp.messages"/>'>
        </div>
        </logic:notEqual>
        <table class="dataTable" border="0" cellspacing="1" cellpadding="2" summary="Search result table" width="100%">
          <tr class="listHeader"> 
            <th id="Checkboxes">&nbsp;</th>
            <th id="Model" align="left">
              <bean-el:message key="header.processModel" bundle="bp.messages"/>
            </th>
            <th id="Package" align="left">
              <bean-el:message key="header.processPackage" bundle="bp.messages"/>
            </th>
            <th id="LastModifiedDate" align="left">
              <bean-el:message key="header.lastModifiedDate" bundle="bp.messages"/>
            </th>
            <th id="ModelManagerID" align="left">
              <bean-el:message key="header.processModelManagerID" bundle="bp.messages"/>
            </th>
            <th id="Status" align="left">
              <bean-el:message key="header.status" bundle="bp.messages"/>
            </th>
            <th id="Actions" align="left" nowrap>
              <bean-el:message key="header.actions" bundle="bp.messages"/>
            </th>
          </tr>
          <logic:equal name="processSearchView" property="processCount" value="0">
          <tr class="listEven">
            <td align="center" colspan="7">
              <bean-el:message key="bp.process.processSearch.noProcess" bundle="bp.messages"/>
            </td>
          </tr>
          </logic:equal>
          <logic:notEqual name="processSearchView" property="processCount" value="0">
          <logic:iterate id="process" name="processSearchView" property="processes" indexId="i">
            <tr class="<%=i.intValue() % 2 == 0 ? "listEven" : "listOdd" %>">
              <td headers="Checkboxes" align="center">
                <input type="checkbox" name="processOids"
                  onClick="update(this.form.processOids, this.form.selectAllProcesses);" 
                  value="<c:out value="${process.map.oid}"/>"/>
              </td>
              <td headers="Model">
                <html-el:link page="/bp/processView.do" paramId="processOid" paramName="process" paramProperty="oid">
                  <c:out value="${process.map.name}"/>
                </html-el:link>
              </td>
              <td headers="Package">
                <html-el:link page="/bp/packageView.do" paramId="id" paramName="process" paramProperty="packageOid">
                  <c:out value="${process.map.packageName}"/>
                </html-el:link>
              </td>
              <td headers="LastModifiedDate">
                <bean:write name="process" property="lastModifiedDate" formatKey="format.datetime.short" bundle="mc.messages"/>
              </td>
              <td headers="ModelManagerID">
                <logic:equal name="process" property="managerId" value="-1">
                  <logic:notEmpty name="process" property="managerAlias">
                    <c:out value="${process.map.managerAlias}"/><bean-el:message key="bp.process.processSearch.invalidSymbol" bundle="bp.messages"/>
                  </logic:notEmpty>
                  <logic:empty name="process" property="managerAlias">
                    &nbsp;
                  </logic:empty>
                </logic:equal>
                <logic:notEqual name="process" property="managerId" value="-1">
                  <c:out value="${process.map.managerAlias}"/>
                </logic:notEqual>
              </td>
              <td headers="Status">
                <logic:equal name="process" property="status" value="0">
                  <bean-el:message key="bp.process.status.inDeployment" bundle="bp.messages"/>
                </logic:equal>
                <logic:equal name="process" property="status" value="1">
                  <logic:equal name="process" property="online" value="true">
                    <bean-el:message key="bp.process.status.online" bundle="bp.messages"/>
                  </logic:equal>
                  <logic:equal name="process" property="online" value="false">
                    <bean-el:message key="bp.process.status.offline" bundle="bp.messages"/>
                  </logic:equal>
                </logic:equal>
                <logic:equal name="process" property="status" value="2">
                  <bean-el:message key="bp.process.status.error" bundle="bp.messages"/>
                </logic:equal>
                <logic:equal name="process" property="status" value="3">
                  <bean-el:message key="bp.process.status.toBeConfigured" bundle="bp.messages"/>
                </logic:equal>
              </td>
              <td nowrap align="left" headers="Actions">
                <a href='#' onclick="doProcessEditAction('<c:out value="${process.map.oid}"/>');"><c:out value='${editImg}' escapeXml="false"/></a>
                <logic:equal name="process" property="status" value="1">
                  <logic:equal name="process" property="online" value="false">
                    <a href='#' onclick="doProcessOnOffOneAction('<c:out value="${process.map.oid}"/>', true);"><c:out value='${onlineImg}' escapeXml="false"/></a>
                  </logic:equal>
                  <logic:equal name="process" property="online" value="true">
                    <a href='#' onclick="doProcessOnOffOneAction('<c:out value="${process.map.oid}"/>', false);"><c:out value='${offlineImg}' escapeXml="false"/></a>
                  </logic:equal>
                </logic:equal>
                <a href='#' onclick="doProcessInstancesAction('<c:out value="${process.map.oid}"/>');"><c:out value='${viewImg}' escapeXml="false"/></a>
              </td>
            </tr>
          </logic:iterate>
          </logic:notEqual>
        </table>
        <logic:notEqual name="processSearchView" property="processCount" value="0">
          <div class="pagination">
            <bean-el:message key="bp.report.criteria.show" bundle="bp.messages"/>
            <html-el:text name="processSearchForm" property="entriesPerPage" size="10" maxlength="10" onkeypress="return checkNumberOnly(event)"/>
            <bean-el:message key="bp.report.criteria.itemsPerPage" bundle="bp.messages"/>
            &nbsp;
            <html-el:button property="go" styleClass="inputButton"
              onclick="return doGo('processSearchForm');">
              <bean-el:message key="button.goto" bundle="bp.messages"/>
            </html-el:button>
            <logic:greaterThan name="processSearchForm" property="totalPageNumber" value="1">
              &nbsp;&nbsp;&nbsp;
              <logic:greaterThan name="processSearchForm" property="currentPageNumber" value="0">
                <logic:greaterThan name="processSearchForm" property="totalPageNumber" value="1">
                  <logic:greaterThan name="processSearchForm" property="currentPageNumber" value="1">
                    <a href="#" class="paginationBtn" onclick="javascript:gotoFirstPage('processSearchForm')">
                      <bean-el:message key="bp.common.pagination.first" bundle="bp.messages"/></a>
                    <a href="#" class="paginationBtn" onclick="javascript:gotoPreviousPage('processSearchForm')">
                      <bean-el:message key="bp.common.pagination.previous" bundle="bp.messages"/></a>
                  </logic:greaterThan>
                </logic:greaterThan>
                <bean:define id="currentPageNumberAttr" name="processSearchForm" property="currentPageNumber"/>
                <bean:define id="totalPageNumberAttr" name="processSearchForm" property="totalPageNumber"/>
                <% Integer currentPageNumberInt = (Integer)pageContext.getAttribute("currentPageNumberAttr"); %>
                <% Integer totalPageNumberInt = (Integer)pageContext.getAttribute("totalPageNumberAttr"); %>
                <bean-el:message key="bp.common.pagination.pageOf" 
                  arg0="<%= currentPageNumberInt.toString() %>" 
                  arg1="<%= totalPageNumberInt.toString() %>" bundle="bp.messages"/>
                <logic:greaterThan name="processSearchForm" property="totalPageNumber" value="1">
                  <logic:equal name="processSearchForm" property="lastPage" value="false">
                    <a href="#" class="paginationBtn" onclick="javascript:gotoNextPage('processSearchForm')">
                      <bean-el:message key="bp.common.pagination.next" bundle="bp.messages"/></a>
                    <a href="#" class="paginationBtn" onclick="javascript:gotoLastPage('processSearchForm')">
                      <bean-el:message key="bp.common.pagination.last" bundle="bp.messages"/></a>
                  </logic:equal>
                </logic:greaterThan>
              </logic:greaterThan>
            </logic:greaterThan>
          </div>
        </logic:notEqual>
      </logic:notEqual>
    </td>
  </tr>
</table>
</html-el:form>

